<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        function numCompany () {
            var n = 1
            function getNum () {
                return ++n
            }
            return getNum
        }

        // fn接收的是numCompany的返回值，也就是getNum本身也就是getNum的地址
        var fn = numCompany()
        console.log(fn())
        console.log(fn())
        console.log(fn())

    </script>
</body>
</html>